// pages/chongzhi/chongzhi.js
/*Page({
 
  data: {
    un_click1: 'money_box',
    un_click2: 'money_box',
    un_click3: 'money_box',
    un_click4: 'money_box',
    un_click5: 'money_box',
    un_click6: 'money_box',
    money:''
  },
  lv1: function () {
    this.setData({
      un_click2: 'money_box',
      un_click3: 'money_box',
      un_click4: 'money_box',
      un_click5: 'money_box',
      un_click6: 'money_box',
      un_click1: 'money_box1',
      money:'10'
    })
    
  },
  lv2: function () {
    this.setData({
      un_click2: 'money_box1',
      un_click3: 'money_box',
      un_click4: 'money_box',
      un_click5: 'money_box',
      un_click6: 'money_box',
      un_click1: 'money_box',
      money: '30'
  },
  lv3: function () {
    this.setData({
      un_click2: 'money_box',
      un_click3: 'money_box1',
      un_click4: 'money_box',
      un_click5: 'money_box',
      un_click6: 'money_box',
      un_click1: 'money_box',
      money: '50'
    })
  },
  lv4: function () {
    this.setData({
      un_click2: 'money_box',
      un_click3: 'money_box',
      un_click4: 'money_box1',
      un_click5: 'money_box',
      un_click6: 'money_box',
      un_click1: 'money_box',
      money: '100'
    })
  },
  lv5: function () {
    this.setData({
      un_click2: 'money_box',
      un_click3: 'money_box',
      un_click4: 'money_box',
      un_click5: 'money_box1',
      un_click6: 'money_box',
      un_click1: 'money_box',
      money: '300'
    })
  },
  lv6: function () {
    this.setData({
      un_click2: 'money_box',
      un_click3: 'money_box',
      un_click4: 'money_box',
      un_click5: 'money_box',
      un_click6: 'money_box1',
      un_click1: 'money_box',
      money:'500'
    })
  },
  chongzhi:function(){
    var num = parseInt(this.data.money);
    wx.request({
      url: 'http://127.0.0.1/charge',
      data:{
        u_id:wx.getStorageSync("openid")
      },
      success:function(){
        wx.showToast({
          title: '成功',
          icon:'success',
          duration:2000
        })
      },
      fail:function(){
       wx.showToast({
         title: '失败',
         icon:'fail',
         duration:2000
       })
      }
    })
  }

})*/
Page({
  /**
   * 页面的初始数据
   */
  data: {
    money:'',
    un_click1: 'money_box',
    un_click2: 'money_box',
    un_click3: 'money_box',
    un_click4: 'money_box',
    un_click5: 'money_box',
    un_click6: 'money_box'
  },
  lv1: function () {
    this.setData({
      money:'10',
      un_click2: 'money_box',
      un_click3: 'money_box',
      un_click4: 'money_box',
      un_click5: 'money_box',
      un_click6: 'money_box',
      un_click1: 'money_box1'
    })
  },
  lv2: function () {
    this.setData({
      money:'30',
      un_click2: 'money_box1',
      un_click3: 'money_box',
      un_click4: 'money_box',
      un_click5: 'money_box',
      un_click6: 'money_box',
      un_click1: 'money_box'
    })
  },
  lv3: function () {
    this.setData({
      money: '50',
      un_click2: 'money_box',
      un_click3: 'money_box1',
      un_click4: 'money_box',
      un_click5: 'money_box',
      un_click6: 'money_box',
      un_click1: 'money_box'
    })
  },
  lv4: function () {
    this.setData({
      money: '100',
      un_click2: 'money_box',
      un_click3: 'money_box',
      un_click4: 'money_box1',
      un_click5: 'money_box',
      un_click6: 'money_box',
      un_click1: 'money_box'
    })
  },
  lv5: function () {
    this.setData({
      money: '300',
      un_click2: 'money_box',
      un_click3: 'money_box',
      un_click4: 'money_box',
      un_click5: 'money_box1',
      un_click6: 'money_box',
      un_click1: 'money_box'
    })
  },
  lv6: function () {
    this.setData({
      money: '500',
      un_click2: 'money_box',
      un_click3: 'money_box',
      un_click4: 'money_box',
      un_click5: 'money_box',
      un_click6: 'money_box1',
      un_click1: 'money_box'
    })
  },
  chongzhi: function () {
    var num = parseInt(this.data.money);
    wx.request({
      url: 'https://www.hkzhaoscut.top/charge',
      data: {
        u_id: wx.getStorageSync("openid"),
        amount:num
      },
      success: function () {
        wx.showToast({
          title: '充值成功',
          icon: 'success',
          duration: 2000
        });
      },
      fail: function () {
          wx.redirectTo({
            url: '../msg_fail/msg_fail',
          })
      }
    })
  }
})


